home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / adasmall / atest2.ada < prev    next >
Text File  |  1996-01-30  |  1KB  |  54 lines

  1. -- This program can be used to demonstrate the scheduling techniques
  2. -- since Task1 will have higher priority than Task2, so more
  3. -- A's will be printed out than B's at a time if scheduled using
  4. -- scheduling techniques 3 and 5
  5.  
  6. with SMALL_SP; use SMALL_SP;
  7. procedure Atest2 is
  8.  
  9.    task Task1 is
  10.      entry start;
  11.    end Task1;
  12.  
  13.    task Task2 is
  14.      entry start;
  15.    end Task2;
  16.  
  17.  
  18.    task body Task1 is
  19.      k : INTEGER;
  20.    begin
  21.        accept start;
  22.        for k in 0..20 loop
  23.          PUT("A");
  24.          if (k mod 5 = 0) then
  25.            delay 0.55;
  26.          end if;
  27.        end loop;
  28.    end Task1;
  29.  
  30.    task body Task2 is
  31.      k : INTEGER;
  32.    begin
  33.        accept start;
  34.        for k in 0..20 loop
  35.          PUT("B");
  36.          if (k mod 5 = 0) then
  37.            delay 0.55;
  38.          end if;
  39.        end loop;
  40.    end Task2;
  41.  
  42.  
  43.  
  44. begin
  45.   PUT("In this run Task1 has higher priority than Task2, so more A's");
  46.   NEW_LINE;
  47.   PUT("will be printed at one time than B's if using methods 3 and 5");
  48.   NEW_LINE;
  49.   NEW_LINE;
  50.   NEW_LINE;
  51.   Task1.start;
  52.   Task2.start;
  53. end Atest2;
  54.